#include<iostream>
#include<cmath>
#include<unordered_map>
using namespace std;
typedef long long LL;
const int N = 1e6 + 10;
int primes[N];
bool st[N];
int cnt;
int n;
unordered_map<LL, int>mp;
bool prime(int x)
{
	for (int i = 2; i <= x / i; i++) {
		if (x % i == 0)return 0;
	}
	return 1;
}

void fun()
{
	for (int i = 2; i <= N - 1; i++) {
		if (!st[i]) {
			primes[++cnt] = i;
			mp[i * i] = 1;
		}
		for (int j = 1; primes[j] <= N - 1; j++) {
			st[primes[j] * i] = 1;
			if (i % primes[j] == 0)break;
		}
	}
}
int main()
{
	cin >> n;
	while (n--) {
		LL x;
		scanf("%lld", &x);
		if (mp[x]) {
			printf("YES\n");
		}
		else {
			printf("NO\n");
		}
		/*if (x == 1) {
			cout << "NO" << endl;
			continue;
		}
		int m = sqrt(x);
		if (m * m == x && prime(m)) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}*/
	}
	return 0;
}